package com.currentcms.shared.model;

import java.util.ArrayList;
import java.util.List;

public class DataType
{
	List<DataProperty> properties;

	// role / can(not) browse, edit
	
	public DataType()
	{
		properties = new ArrayList<DataProperty>();
	}
	
	public DataProperty addProperty(String name, int type)
	{
		return addProperty(name,type,false);
	}

	public DataProperty addProperty(String name, int type, boolean is_array)
	{
		DataProperty dp = new DataProperty();
		dp.name = name;
		dp.type = type;
		dp.isArray = is_array;
		properties.add(dp);
		return dp;
	}
	
	public DataProperty addReference(String name, String referenceType)
	{
		return addReference(name,referenceType,false);
	}
	
	public DataProperty addReference(String name, String referenceType, boolean is_array)
	{
		DataProperty dp = new DataProperty();
		dp.name = name;
		dp.type = DataProperty.TYPE_REFERENCE;
		dp.referenceType = referenceType;
		dp.isArray = is_array;
		properties.add(dp);
		return dp;
	}
}
